var start='';
var end='';
var list='';
//起始时间查询触发事件
function clicke(){
	
	var myChart = echarts.init(document.getElementById('main')); 
    window.onresize = myChart.resize;
	end=$('#reportform-end_time').val();
	start=$('#reportform-start_time').val();
	if(start>end){
		alert('时间选择错误');
		return false;
	}
	myTable.draw( false );
	$.ajax({
		type:"post",
		url:"index.php?r=bgds/table",
		//async:false,
		data:{
			action:'action',
			start_time:start,
			end_time:end,
			
		},
		dataType:'json',
		success:function(result){
			if(result){
				b = eval(result);
				//alert(b[1]);
				
				option.legend.data = b[0];
				option['xAxis'][0].data = b[1];
				option['yAxis'] = b[2];
				option['series'] = b[3];
				myChart.hideLoading();
				myChart.setOption(option);
			}else{
				alert("数据读取出现错误");
			}
			 
		}
			
	});
	
     }
	//时段查询触发事件
	function aaaa(){
		
		list=$('#reportform-list').val();	
		myTable.draw( false );
		
		var myChart = echarts.init(document.getElementById('main')); 
	    window.onresize = myChart.resize;
		
		$.ajax({
			type:"post",
			url:"index.php?r=bgds/table",
			//async:false,
			data:{
				action:'timeframe',
				list:list
			},
			dataType:'json',
			success:function(result){
				if(result){
					b = eval(result);
					//alert(b[1]);
					
					option.legend.data = b[0];
					option['xAxis'][0].data = b[1];
					option['yAxis'] = b[2];
					option['series'] = b[3];
					myChart.hideLoading();
					myChart.setOption(option);
				}else{
					alert("数据读取出现错误");
				}
				 
			}
				
		});
		
		
		
	}
	
	$(window).load(function() {
		   
		
		$.ajax({
			type:"post",
			url:"index.php?r=bgds/table",
			//async:false,
			data:{
				action:'action',
				start_time:start,
				end_time:end
				
			},
			dataType:'json',
			success:function(result){
				if(result){
					b = eval(result);
					//alert(b[1]);
					option.legend.data = b[0];
					option['xAxis'][0].data = b[1];
					option['yAxis'] = b[2];
					option['series'] = b[3];
					myChart.hideLoading();
					myChart.setOption(option);
				}else{
					alert("数据读取出现错误");
				}
				 
			}
				
		});
		
		// 基于准备好的dom，初始化echarts图表
        var myChart = echarts.init(document.getElementById('main')); 
        window.onresize = myChart.resize;
        // 过渡---------------------
        myChart.showLoading({
            text: '正在努力的读取数据中...',    //loading话术
        });
        option = {
        	    tooltip : {
        	        trigger: 'axis'
        	    },
        	    toolbox: {
        	        show : true,
        	        feature : {
        	            mark : {show: true},
        	            dataView : {show: true, readOnly: false},
        	            magicType: {show: true, type: ['line', 'bar']},
        	            restore : {show: true},
        	            saveAsImage : {show: true}
        	        }
        	    },
        	    calculable : true,
        	    legend: {
        	        data:['','']
        	    },
        	    xAxis : [
        	        {
        	            type : 'category',
        	            data : ['','','','','','','','','','','','']
        	        }
        	    ],
        	    yAxis : [
        	       
        	    ],
        	    series : [

        	      
        	    ]
        	};
        	                    

        // 为echarts对象加载数据 
        myChart.setOption(option); 
       
     
		
		
	})

	
	